package com.gisuni.sddc.platformManager.model;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.ManyMany;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;




/**
 * ResourceInfoId entity. @author MyEclipse Persistence Tools
 */
@Table(value = "SDDCGISPLATFORM.RESOURCE_INFO")
public class ResourceInfo implements java.io.Serializable {

	// Fields
	@Column(value = "ID" )
	@Name
	private String id;
	
	@Column(value = "RESOURCE_NAME" )
	
	private String resourceName;
	
	@Column(value = "RESOURCE_TYPE" )
	
	private String resourceType;
	
	@Column(value = "RESOURCE_INDEX" )
	
	private BigDecimal resourceIndex;
	
	@Column(value = "PARENT_ID" )
	
	private String parentId;
	
	@Column(value = "CREATE_TIME" )
	
	private Date createTime;
	
	@Column(value = "UPDATE_TIME" )
	private Date updateTime;

	@ManyMany(target = RoleInfo.class,relation ="SDDCGISPLATFORM.ROLE_R_RESOURCE",from="RESOURCE_ID",to="ROLE_ID")
	private List<RoleInfo> roleInfos;
	
	public List<RoleInfo> getRoleInfos() {
		return roleInfos;
	}

	public void setRoleInfos(List<RoleInfo> roleInfos) {
		this.roleInfos = roleInfos;
	}

	/** default constructor */
	public ResourceInfo() {
	}

	/** minimal constructor */
	public ResourceInfo(String id, String resourceName) {
		this.id = id;
		this.resourceName = resourceName;
	}

	/** full constructor */
	public ResourceInfo(String id, String resourceName, String resourceType,
			BigDecimal resourceIndex, String parentId, Date createTime,
			Date updateTime) {
		this.id = id;
		this.resourceName = resourceName;
		this.resourceType = resourceType;
		this.resourceIndex = resourceIndex;
		this.parentId = parentId;
		this.createTime = createTime;
		this.updateTime = updateTime;
	}

	// Property accessors

	
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getResourceName() {
		return this.resourceName;
	}

	public void setResourceName(String resourceName) {
		this.resourceName = resourceName;
	}


	public String getResourceType() {
		return this.resourceType;
	}

	public void setResourceType(String resourceType) {
		this.resourceType = resourceType;
	}


	public BigDecimal getResourceIndex() {
		return this.resourceIndex;
	}

	public void setResourceIndex(BigDecimal resourceIndex) {
		this.resourceIndex = resourceIndex;
	}


	public String getParentId() {
		return this.parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	
	
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}


	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof ResourceInfo))
			return false;
		ResourceInfo castOther = (ResourceInfo) other;

		return ((this.getId() == castOther.getId()) || (this.getId() != null
				&& castOther.getId() != null && this.getId().equals(
				castOther.getId())))
				&& ((this.getResourceName() == castOther.getResourceName()) || (this
						.getResourceName() != null
						&& castOther.getResourceName() != null && this
						.getResourceName().equals(castOther.getResourceName())))
				&& ((this.getResourceType() == castOther.getResourceType()) || (this
						.getResourceType() != null
						&& castOther.getResourceType() != null && this
						.getResourceType().equals(castOther.getResourceType())))
				&& ((this.getResourceIndex() == castOther.getResourceIndex()) || (this
						.getResourceIndex() != null
						&& castOther.getResourceIndex() != null && this
						.getResourceIndex()
						.equals(castOther.getResourceIndex())))
				&& ((this.getParentId() == castOther.getParentId()) || (this
						.getParentId() != null
						&& castOther.getParentId() != null && this
						.getParentId().equals(castOther.getParentId())))
				&& ((this.getCreateTime() == castOther.getCreateTime()) || (this
						.getCreateTime() != null
						&& castOther.getCreateTime() != null && this
						.getCreateTime().equals(castOther.getCreateTime())))
				&& ((this.getUpdateTime() == castOther.getUpdateTime()) || (this
						.getUpdateTime() != null
						&& castOther.getUpdateTime() != null && this
						.getUpdateTime().equals(castOther.getUpdateTime())));
	}

	public int hashCode() {
		int result = 17;

		result = 37 * result + (getId() == null ? 0 : this.getId().hashCode());
		result = 37
				* result
				+ (getResourceName() == null ? 0 : this.getResourceName()
						.hashCode());
		result = 37
				* result
				+ (getResourceType() == null ? 0 : this.getResourceType()
						.hashCode());
		result = 37
				* result
				+ (getResourceIndex() == null ? 0 : this.getResourceIndex()
						.hashCode());
		result = 37 * result
				+ (getParentId() == null ? 0 : this.getParentId().hashCode());
		result = 37
				* result
				+ (getCreateTime() == null ? 0 : this.getCreateTime()
						.hashCode());
		result = 37
				* result
				+ (getUpdateTime() == null ? 0 : this.getUpdateTime()
						.hashCode());
		return result;
	}

}